<?php
$params = array_merge(
	require (__DIR__ . '/../../common/config/params.php'),
	require (__DIR__ . '/../../common/config/params-local.php'),
	require (__DIR__ . '/params.php'),
	require (__DIR__ . '/params-local.php')
);

return [
	'id' => 'app-console',
	'basePath' => dirname(__DIR__),
	'bootstrap' => ['log'],
	'controllerNamespace' => 'console\controllers',
	'components' => [
		'swooleClient' => [
			'class' => 'common\components\SwooleClient',
		],
		'log' => [
			//'traceLevel' => YII_DEBUG ? 3 : 0,
			'flushInterval' => 1,
			'targets' => [
				[
					'class' => 'yii\log\FileTarget',
					'logFile' => '/mnt/logs/yii_swoole_' . date("Y-m-d") . '.log',
					'levels' => ['info', 'trace', 'error', 'warning'],
					'logVars' => ['_POST','_GET'],
					'maxFileSize' => 1024 * 1, //KB  1M
					'maxLogFiles' => 9,
					'rotateByCopy' => false,
					'exportInterval' => 1,
					'prefix' => function ($message) {
						//$array=explode("^",$message);
						$route = \Yii::$app->requestedRoute;
						// if(empty($route)){
						// 	if(count($array) > 1){
						// 		$route = $array[0];
						// 	}else{
						// 		$route = 'unkmown';
						// 	}
						// }
						//$action = Yii::$app->controller->action;
						$pid = getmypid();
						return '[' . $route . '][' . $pid . ']';
					},
				],
			],
		],
	],

	'params' => $params,
];
